home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / misc / textloader / rexx / sendtopageliner.rexx < prev    next >
OS/2 REXX Batch file  |  1999-04-19  |  2KB  |  92 lines

  1. /* Send text from TLNG to PageLiner */
  2. /*  PL-V1.0 © 13.03.99 by Jochen Grus */
  3.  
  4. OPTIONS RESULTS
  5. TRACE OFF
  6.  
  7. /* Make sure rexx support is opened */
  8. IF ~SHOW('L','rexxsupport.library') THEN
  9.    CALL ADDLIB('rexxsupport.library',0,-30)
  10.  
  11.  
  12. /* set the default PageLiner path */
  13. plpath='PageStream3:PageLiner'
  14. preffile='PageStream3:SendtoPageLiner.prefs'
  15.  
  16. /* If PageLiner doesn't exist in the default path, check SendtoPageLiner.prefs */
  17. if ~exists(plpath) then do
  18.     if open(.ifile, preffile, 'R') then do
  19.         plpath=readln(.ifile)
  20.         call close(.ifile)
  21.         askuser='no'
  22.         end
  23.     else do
  24.         askuser='yes'
  25.     end
  26.     /* If PageLiner doesn't exist in the set pref path, ask the user where it is */
  27.     if ~exists(plpath) | askuser='yes' then do
  28.         getfile TITLE "'Please locate PageLiner'" load path "'PageStream3:'" file 'PageLiner' posbutton 'Ok' negbutton 'Cancel'
  29.         if RC=10 then signal cancel
  30.         plpath=result
  31.         if open(.ifile, preffile, 'W') then do
  32.             call writeln(.ifile, plpath)
  33.             call close(.ifile)
  34.         end
  35.     end
  36. end
  37.  
  38.  
  39. /* Run PageLiner */
  40. ADDRESS COMMAND
  41. 'run >nil:' PLpath
  42.  
  43. /* Wait until the ARexx port shows up */
  44. do 20
  45.     if ~show(P, 'PAGELINER') then call delay(50)
  46. end
  47.  
  48. /* If the ARexx port didn't show up, alert the user and exit */
  49. if ~show(P, 'PAGELINER') then do
  50.     ADDRESS 'PAGESTREAM'
  51.     allocarexxrequester '"Send to Editor Error!"' 368 59
  52.     reqhandle=result
  53.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  54.         Exithandle=result
  55.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'PageLiner could not be started.'"
  56.     doarexxrequester reqhandle
  57.     freearexxrequester reqhandle
  58.     'refresh continue'
  59.     'lockinterface false'
  60.     EXIT
  61. end
  62.  
  63. ADDRESS 'PAGELINER'
  64. 'open ram:clipboards/0'
  65. 'cursor down'
  66.  
  67. /* Wait for the user to finish in PageLiner */
  68. do forever
  69.     if show(P, 'PAGELINER') then do
  70.         'getarticle ram:clipboards/0'
  71.         if rc=0 then call delay(50)
  72.         else signal update
  73.     end
  74.     else signal update
  75. end
  76.  
  77. /* Update PageStream and exit */
  78.  
  79. 'inserttext file ram:clipboards/0'
  80.  
  81. /* deselect the text if rquired */
  82. if sID=eID then selecttext none
  83.  
  84. signal cancel
  85.  
  86. CANCEL:
  87. ADDRESS 'PAGESTREAM'
  88. 'refresh continue'
  89. 'lockinterface false'
  90. ADDRESS COMMAND
  91. EXIT
  92.